#include "junix.h"
using namespace std;

struct A
{
	int v_;
	A(int n):v_(n){}
	int operator() ()
	{
		return v_ ++;
	}
};

int main(int argc, char **argv)
{
	vector<int> V(30);
	generate(V.begin(), V.end(),A(0));
	ostream_iterator<int>  oit(cout, " ");
	partial_sum(V.begin(),V.end(),oit);
	cout<<endl;

	partial_sum(V.begin(),V.end(),oit, multiplies<int>());
	cout<<endl;

	partial_sum(V.begin(),V.end(),oit, minus<int>());
	cout<<endl;

	adjacent_difference(V.begin(), V.end(),oit);
	cout<<endl;

	adjacent_difference(V.begin(),V.end(),oit, plus<int>());
	cout<<endl;
}
